#include "head.h"

// do_ls函数：处理列出当前虚拟目录文件的操作
void do_ls(client_status_t *client_stat) {

    self_defined_pro_t *mes=(self_defined_pro_t *)calloc(1,sizeof(self_defined_pro_t));
    strcat(mes->message,"username=");
    strcat(mes->message,client_stat->user);
    strcat(mes->message,"&");
    strcat(mes->message,"path=");
    strcat(mes->message,client_stat->path);
    mes->cmd=ls;
    mes->message_len=strlen(mes->message);
    mes->para_num=2;

    send(client_stat->socket_fd, mes, sizeof(self_defined_pro_t), MSG_NOSIGNAL);
    free(mes);

    self_defined_pro_t *res=(self_defined_pro_t *)calloc(1,sizeof(self_defined_pro_t));
    recv(client_stat->socket_fd, res, sizeof(self_defined_pro_t), MSG_WAITALL);
    printf("%s", res->message); // 直接输出服务器返回的内容

    free(res);
    return ;
}
